﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using XiaoGang.Soft.XGWMS.COM;
using Excel;
using System.IO;
using System.Reflection;

namespace XiaoGang.Soft.XGWMS.UI
{
    public partial class M014_Bills : FormBase
    {
        public M014_Bills()
        {
            InitializeComponent();
        }

        #region 变量定义

        BLL.BLL_M012_MEMBER bll_M012_Member = new XiaoGang.Soft.XGWMS.BLL.BLL_M012_MEMBER();
        private bool blInit=true;
        private const string dataName = "货单";

        #endregion

        #region 方法

        protected void SetTableIndex()
        {
            int intIndex = 0;
            grpBuyDetailInfo.TabIndex = intIndex; intIndex++;
            dtpDateFrom1.TabIndex = intIndex; intIndex++;
            dtpDateTo1.TabIndex = intIndex; intIndex++;
            ckbDetail1.TabIndex = intIndex; intIndex++;
            btnSearch1.TabIndex = intIndex; intIndex++;
            grpBillDetailInfo.TabIndex = intIndex; intIndex++;
            btnPrint.TabIndex = intIndex; intIndex++;
            btnClose.TabIndex = intIndex; intIndex++;
        }

        /// <summary>
        /// <p><b>方法名称</b>InitialGridView</p>
        /// <p><b>概要説明	:</b>Grid初始化</p>
        /// <p><b>作成者	:</b>万岗</p>
        /// <p><b>作成日	:</b>2008/09/10</p>
        /// </summary>
        protected void InitialGridView()
        {
            //grdDetailInfo1.Height = 382;
            //grdDetailInfo2.Height = 382;
            //grdDetailInfo3.Height = 382;
            //销售明细
            grdDetailInfo1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised;
            grdDetailInfo1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            grdDetailInfo1.ReadOnly = true;
            grdDetailInfo1.ColumnHeadersHeight = 30;
            grdDetailInfo1.ColumnHeadersVisible = true;
            grdDetailInfo1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            grdDetailInfo1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            grdDetailInfo1.Columns.Add("NO.", "NO.");
            grdDetailInfo1.Columns.Add("BUSINESS_TIME", "日期");
            grdDetailInfo1.Columns.Add("BILL_ID", "流水号");
            grdDetailInfo1.Columns.Add("GOODS_NM1", "商品名称");
            grdDetailInfo1.Columns.Add("SELLING_PRICE", "价格");
            grdDetailInfo1.Columns.Add("UNITS", "数量");
            grdDetailInfo1.Columns.Add("AllPrice", "合计");
            grdDetailInfo1.Columns.Add("Preferential", "优惠");
            grdDetailInfo1.Columns.Add("BillCount", "本单合计");            
            grdDetailInfo1.Columns.Add("USER_NAME", "会员姓名");
            grdDetailInfo1.Columns.Add("USER_NO", "会员卡号");

            grdDetailInfo1.Columns["NO."].Width = 35;
            grdDetailInfo1.Columns["NO."].Frozen = true;
            grdDetailInfo1.Columns["NO."].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            grdDetailInfo1.Columns["NO."].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["NO."].Resizable = DataGridViewTriState.False;
            //grdmentBillDetailInfo.Columns["NO."].
            grdDetailInfo1.Columns["BUSINESS_TIME"].Width = 100;
            grdDetailInfo1.Columns["BUSINESS_TIME"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            grdDetailInfo1.Columns["BUSINESS_TIME"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["BUSINESS_TIME"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["BILL_ID"].Width = 120;
            grdDetailInfo1.Columns["BILL_ID"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["BILL_ID"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["GOODS_NM1"].Width = 200;
            grdDetailInfo1.Columns["GOODS_NM1"].Frozen = true;            
            grdDetailInfo1.Columns["GOODS_NM1"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["SELLING_PRICE"].Width = 100;
            grdDetailInfo1.Columns["SELLING_PRICE"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo1.Columns["SELLING_PRICE"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["SELLING_PRICE"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["UNITS"].Width = 100;
            grdDetailInfo1.Columns["UNITS"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo1.Columns["UNITS"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["UNITS"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["AllPrice"].Width = 100;
            grdDetailInfo1.Columns["AllPrice"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo1.Columns["AllPrice"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["AllPrice"].Resizable = DataGridViewTriState.False;

            grdDetailInfo1.Columns["BillCount"].Width = 100;
            grdDetailInfo1.Columns["BillCount"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo1.Columns["BillCount"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["BillCount"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["Preferential"].Width =100;
            grdDetailInfo1.Columns["Preferential"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo1.Columns["Preferential"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["Preferential"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["USER_NAME"].Width = 100;
            grdDetailInfo1.Columns["USER_NAME"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["USER_NAME"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["USER_NO"].Width = 100;
            grdDetailInfo1.Columns["USER_NO"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo1.Columns["USER_NO"].Resizable = DataGridViewTriState.False;
            grdDetailInfo1.Columns["USER_NO"].Visible = false;
            grdDetailInfo1.AllowUserToAddRows = false;
            grdDetailInfo1.AllowUserToResizeColumns = true;
            grdDetailInfo1.AllowUserToResizeRows = false;
            grdDetailInfo1.RowHeadersVisible = false;
            grdDetailInfo1.RowTemplate.Resizable = DataGridViewTriState.False;
            grdDetailInfo1.RowTemplate.Height = 20;
            grdDetailInfo1.RowTemplate.ReadOnly = true;

            //进货明细
            grdDetailInfo2.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised;
            grdDetailInfo2.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            grdDetailInfo2.ReadOnly = true;
            grdDetailInfo2.ColumnHeadersHeight = 30;
            grdDetailInfo2.ColumnHeadersVisible = true;
            grdDetailInfo2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            grdDetailInfo2.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            grdDetailInfo2.Columns.Add("NO.", "NO.");
            grdDetailInfo2.Columns.Add("BUSINESS_TIME", "日期");
            grdDetailInfo2.Columns.Add("BILL_ID", "流水号");
            grdDetailInfo2.Columns.Add("GOODS_NM1", "商品名称");
            grdDetailInfo2.Columns.Add("BUYING_PRICE", "进价");
            grdDetailInfo2.Columns.Add("UNITS", "数量");
            grdDetailInfo2.Columns.Add("AllPrice", "合计");
            //grdDetailInfo2.Columns.Add("Preferential", "优惠");
            grdDetailInfo2.Columns.Add("BillCount", "本单合计");
            grdDetailInfo2.Columns.Add("STOREROOM", "仓库");
            //grdDetailInfo2.Columns.Add("USER_NO", "会员卡号");

            grdDetailInfo2.Columns["NO."].Width = 35;
            grdDetailInfo2.Columns["NO."].Frozen = true;
            grdDetailInfo2.Columns["NO."].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            grdDetailInfo2.Columns["NO."].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["NO."].Resizable = DataGridViewTriState.False;
            //grdmentBillDetailInfo.Columns["NO."].
            grdDetailInfo2.Columns["BUSINESS_TIME"].Width = 100;
            grdDetailInfo2.Columns["BUSINESS_TIME"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            grdDetailInfo2.Columns["BUSINESS_TIME"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["BUSINESS_TIME"].Resizable = DataGridViewTriState.False;
            grdDetailInfo2.Columns["BILL_ID"].Width = 120;
            grdDetailInfo2.Columns["BILL_ID"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["BILL_ID"].Resizable = DataGridViewTriState.False;
            grdDetailInfo2.Columns["GOODS_NM1"].Width = 200;
            grdDetailInfo2.Columns["GOODS_NM1"].Frozen = true;
            grdDetailInfo2.Columns["GOODS_NM1"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["BUYING_PRICE"].Width = 100;
            grdDetailInfo2.Columns["BUYING_PRICE"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo2.Columns["BUYING_PRICE"].Resizable = DataGridViewTriState.False;
            grdDetailInfo2.Columns["BUYING_PRICE"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["UNITS"].Width = 100;
            grdDetailInfo2.Columns["UNITS"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo2.Columns["UNITS"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["UNITS"].Resizable = DataGridViewTriState.False;
            grdDetailInfo2.Columns["AllPrice"].Width = 100;
            grdDetailInfo2.Columns["AllPrice"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo2.Columns["AllPrice"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["AllPrice"].Resizable = DataGridViewTriState.False;

            grdDetailInfo2.Columns["BillCount"].Width = 100;
            grdDetailInfo2.Columns["BillCount"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo2.Columns["BillCount"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["BillCount"].Resizable = DataGridViewTriState.False;
            //grdDetailInfo2.Columns["Preferential"].Width = 50;
            //grdDetailInfo2.Columns["Preferential"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            //grdDetailInfo2.Columns["Preferential"].SortMode = DataGridViewColumnSortMode.NotSortable;
            //grdDetailInfo2.Columns["Preferential"].Resizable = DataGridViewTriState.False;
            grdDetailInfo2.Columns["STOREROOM"].Width = 100;
            grdDetailInfo2.Columns["STOREROOM"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo2.Columns["STOREROOM"].Resizable = DataGridViewTriState.False;
            //grdDetailInfo2.Columns["USER_NO"].Width = 72;
            //grdDetailInfo2.Columns["USER_NO"].SortMode = DataGridViewColumnSortMode.NotSortable;
            //grdDetailInfo2.Columns["USER_NO"].Resizable = DataGridViewTriState.False;
            //grdDetailInfo2.Columns["USER_NO"].Visible = false;
            grdDetailInfo2.AllowUserToAddRows = false;
            grdDetailInfo2.AllowUserToResizeColumns = true;
            grdDetailInfo2.AllowUserToResizeRows = false;
            grdDetailInfo2.RowHeadersVisible = false;
            grdDetailInfo2.RowTemplate.Resizable = DataGridViewTriState.False;
            grdDetailInfo2.RowTemplate.Height = 20;
            grdDetailInfo2.RowTemplate.ReadOnly = true;

            //盘库明细
            grdDetailInfo3.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised;
            grdDetailInfo3.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            grdDetailInfo3.ReadOnly = true;
            grdDetailInfo3.ColumnHeadersHeight = 30;
            grdDetailInfo3.ColumnHeadersVisible = true;
            grdDetailInfo3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            grdDetailInfo3.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            grdDetailInfo3.Columns.Add("NO.", "NO.");
            grdDetailInfo3.Columns.Add("BUSINESS_TIME", "日期");
            grdDetailInfo3.Columns.Add("BILL_ID", "流水号");
            grdDetailInfo3.Columns.Add("GOODS_NM1", "商品名称");
            grdDetailInfo3.Columns.Add("UNITS", "盘点更改");
            grdDetailInfo3.Columns.Add("NowUNITS", "库存数量");
            grdDetailInfo3.Columns.Add("STOREROOM_NM", "仓库");

            grdDetailInfo3.Columns["NO."].Width = 35;
            grdDetailInfo3.Columns["NO."].Frozen = true;
            grdDetailInfo3.Columns["NO."].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            grdDetailInfo3.Columns["NO."].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["NO."].Resizable = DataGridViewTriState.False;
            //grdmentBillDetailInfo.Columns["NO."].
            grdDetailInfo3.Columns["BUSINESS_TIME"].Width = 100;
            grdDetailInfo3.Columns["BUSINESS_TIME"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            grdDetailInfo3.Columns["BUSINESS_TIME"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["BUSINESS_TIME"].Resizable = DataGridViewTriState.False;
            grdDetailInfo3.Columns["BILL_ID"].Width = 120;
            grdDetailInfo3.Columns["BILL_ID"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["BILL_ID"].Resizable = DataGridViewTriState.False;
            grdDetailInfo3.Columns["GOODS_NM1"].Width = 200;
            grdDetailInfo3.Columns["GOODS_NM1"].Frozen = true;
            grdDetailInfo3.Columns["GOODS_NM1"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["UNITS"].Width = 100;
            grdDetailInfo3.Columns["UNITS"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo3.Columns["UNITS"].Resizable = DataGridViewTriState.False;
            grdDetailInfo3.Columns["UNITS"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["NowUNITS"].Width = 100;
            grdDetailInfo3.Columns["NowUNITS"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo3.Columns["NowUNITS"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["NowUNITS"].Resizable = DataGridViewTriState.False;
            grdDetailInfo3.Columns["STOREROOM_NM"].Width = 100;
            grdDetailInfo3.Columns["STOREROOM_NM"].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            grdDetailInfo3.Columns["STOREROOM_NM"].SortMode = DataGridViewColumnSortMode.NotSortable;
            grdDetailInfo3.Columns["STOREROOM_NM"].Resizable = DataGridViewTriState.False;
            grdDetailInfo3.AllowUserToAddRows = false;
            grdDetailInfo3.AllowUserToResizeColumns = true;
            grdDetailInfo3.AllowUserToResizeRows = false;
            grdDetailInfo3.RowHeadersVisible = false;
            grdDetailInfo3.RowTemplate.Resizable = DataGridViewTriState.False;
            grdDetailInfo3.RowTemplate.Height = 20;
            grdDetailInfo3.RowTemplate.ReadOnly = true;
        }

        /// <summary>
        /// <p><b>方法名称</b>InitProcess</p>
        /// <p><b>概要説明	:</b>画面的初期化</p>
        /// <p><b>作成者	:</b>万岗</p>
        /// <p><b>作成日	:</b>2008/09/10</p>
        /// </summary>
        protected void InitProcess()
        {
            InitialGridView();
            SetTableIndex();
            InitContranls();
            ShowGrid(1);
            ShowGrid(2);
            ShowGrid(3);
        }

        protected void InitContranls()
        {
            dtpDateFrom1.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
            dtpDateFrom2.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
            dtpDateFrom3.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
            dtpDateTo1.Text = DateTime.Now.ToString("yyyy-MM-dd");
            dtpDateTo2.Text = DateTime.Now.ToString("yyyy-MM-dd");
            dtpDateTo3.Text = DateTime.Now.ToString("yyyy-MM-dd");
            ckbDetail1.Checked = true;
            ckbDetail2.Checked = true;
            ckbDetail3.Checked = true;
            blInit = false;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="searchType">查询类型 1：销售 2：进货 3：盘库</param>
        protected void ShowGrid(int searchType)
        {
            if (this.Cursor == Cursors.WaitCursor)
            {
                return;
            }
            this.Cursor = Cursors.WaitCursor;

            ReturnValue rvGoods;            
            string strDateFrom ="";
            string strDateTo ="";

            if(searchType == 1)
            {
                #region 销售信息

                strDateFrom = dtpDateFrom1.Text.Trim() == "" ? dtpDateFrom1.Value.ToString("yyyyMMdd") : dtpDateFrom1.Text.Trim().Replace("-", "").Replace("/", "");
                strDateTo = dtpDateTo1.Text.Trim() == "" ? dtpDateTo1.Value.ToString("yyyyMMdd") : dtpDateTo1.Text.Trim().Replace("-", "").Replace("/", "");
                if (ckbDetail1.Checked)//
                {
                    //显示详细
                    rvGoods = bll_M012_Member.GetSalesDetail(strDateFrom, strDateTo);
                }
                else
                {
                    //不显示详细
                    rvGoods = bll_M012_Member.GetBillTotalPrice(strDateFrom, strDateTo);
                }
                if (rvGoods.IsSuccess == false)
                {
                    Method.MessageShow(rvGoods.ErrorID,dataName);
                    this.Cursor = Cursors.Default;
                    return;
                }
                grdDetailInfo1.Rows.Clear();

                //显示详细
                if (ckbDetail1.Checked)
                {
                    foreach (DataRow row in rvGoods.ResultDataSet.Tables[0].Rows)
                    {
                        grdDetailInfo1.Rows.Add(
                            (grdDetailInfo1.Rows.Count + 1).ToString(),
                            DateFormat(row["BUSINESS_TIME"].ToString().Trim()),
                            row["BILL_ID"].ToString().Trim(),
                            row["GOODS_NM1"].ToString().Trim(),
                            row["SELLING_PRICE"].ToString().Trim() == "-1.0000" ? "" : string.Format("{0:f2}", decimal.Parse(row["SELLING_PRICE"].ToString().Trim())),
                            row["UNITS"].ToString().Trim(),
                            row["SELLING_PRICE"].ToString().Trim() == "-1.0000" ? "" : string.Format("{0:f2}", decimal.Parse(row["AllPrice"].ToString().Trim())),
                            row["Preferential"].ToString().Trim() == "" ? "" : string.Format("{0:f2}", decimal.Parse(row["Preferential"].ToString().Trim())),
                            row["BillCount"].ToString().Trim() == "" ? "" : string.Format("{0:f2}", decimal.Parse(row["BillCount"].ToString().Trim())),
                            row["USER_NAME"].ToString().Trim(),
                            row["USER_NO"].ToString().Trim());
                        //TotalSales += decimal.Parse(row["AllPrice"].ToString().Trim());
                    }
                }
                //不显示详细
                else
                {
                    foreach (DataRow row in rvGoods.ResultDataSet.Tables[0].Rows)
                    {
                        grdDetailInfo1.Rows.Add(
                            (grdDetailInfo1.Rows.Count + 1).ToString(),
                            DateFormat(row["BUSINESS_TIME"].ToString().Trim()),
                            row["BILL_ID"].ToString().Trim(),
                            row["GOODS_NM1"].ToString().Trim(),
                            row["SELLING_PRICE"].ToString().Trim(),
                            row["UNITS"].ToString().Trim(),
                            row["SELLING_PRICE"].ToString().Trim(),
                            row["Preferential"].ToString().Trim() == "" ? "" : string.Format("{0:f2}", decimal.Parse(row["Preferential"].ToString().Trim())),
                            row["BillCount"].ToString().Trim() == "" ? "" : string.Format("{0:f2}", decimal.Parse(row["BillCount"].ToString().Trim()) - (row["Preferential"].ToString().Trim() == "" ? 0 : decimal.Parse(row["Preferential"].ToString().Trim()))),
                            row["USER_NAME"].ToString().Trim(),
                            row["USER_NO"].ToString().Trim());
                        //TotalSales += decimal.Parse(row["BillCount"].ToString().Trim() == "" ? "0" : row["BillCount"].ToString().Trim());
                    }
                }
                //if (grdDetailInfo1.Rows.Count > 17)
                //{
                //    grdDetailInfo1.Columns["GOODS_NM1"].Width = 153;
                //}
                //else
                //{
                //    grdDetailInfo1.Columns["GOODS_NM1"].Width = 170;
                //}
                //grpBillDetailInfo.Text = "销售总额:" + string.Format("{0:f2}",TotalSales) + "  共有" + grdmentBillDetailInfo.Rows.Count + "条销售记录";
                SetGridBackColor(1);
                //清除Grid中的重複數據
                ClearGridRepeatData(1);

                #endregion
            }
            else if(searchType ==2)
            {
                #region 进货信息

                strDateFrom = dtpDateFrom2.Text.Trim() == "" ? dtpDateFrom2.Value.ToString("yyyyMMdd") : dtpDateFrom2.Text.Trim().Replace("-", "").Replace("/", "");
                strDateTo = dtpDateTo2.Text.Trim() == "" ? dtpDateTo2.Value.ToString("yyyyMMdd"): dtpDateTo2.Text.Trim().Replace("-", "").Replace("/", "");
                if (ckbDetail2.Checked)//
                {
                    //显示详细
                    rvGoods = bll_M012_Member.GetBuyDetail(strDateFrom, strDateTo);
                }
                else
                {
                    //不显示详细
                    rvGoods = bll_M012_Member.GetBuyTotalPrice(strDateFrom, strDateTo);
                }
                if (rvGoods.IsSuccess == false)
                {
                    Method.MessageShow(rvGoods.ErrorID,dataName);
                    this.Cursor = Cursors.Default;
                    return;
                }
                grdDetailInfo2.Rows.Clear();

                //显示详细
                if (ckbDetail2.Checked)
                {
                    foreach (DataRow row in rvGoods.ResultDataSet.Tables[0].Rows)
                    {
                        grdDetailInfo2.Rows.Add(
                            (grdDetailInfo2.Rows.Count + 1).ToString(),
                            DateFormat(row["BUSINESS_TIME"].ToString().Trim()),
                            row["BILL_ID"].ToString().Trim(),
                            row["GOODS_NM1"].ToString().Trim(),
                            row["BUYING_PRICE"].ToString().Trim() == "-1.0000" ? "" : string.Format("{0:f2}", decimal.Parse(row["BUYING_PRICE"].ToString().Trim())),
                            row["UNITS"].ToString().Trim(),
                            row["BUYING_PRICE"].ToString().Trim() == "-1.0000" ? "" : string.Format("{0:f2}", decimal.Parse(row["AllPrice"].ToString().Trim())),
                            row["BillCount"].ToString().Trim() == "" ? "" : string.Format("{0:f2}", decimal.Parse(row["BillCount"].ToString().Trim())),
                            row["STOREROOM_NM"].ToString().Trim());
                        //TotalSales += decimal.Parse(row["AllPrice"].ToString().Trim());
                    }
                }
                //不显示详细
                else
                {
                    foreach (DataRow row in rvGoods.ResultDataSet.Tables[0].Rows)
                    {
                        grdDetailInfo2.Rows.Add(
                            (grdDetailInfo2.Rows.Count + 1).ToString(),
                            DateFormat(row["BUSINESS_TIME"].ToString().Trim()),
                            row["BILL_ID"].ToString().Trim(),
                            row["GOODS_NM1"].ToString().Trim(),
                            row["BUYING_PRICE"].ToString().Trim(),
                            row["UNITS"].ToString().Trim(),
                            row["AllPrice"].ToString().Trim(),
                            row["BillCount"].ToString().Trim() == "" ? "" : string.Format("{0:f2}", decimal.Parse(row["BillCount"].ToString().Trim())),
                            row["STOREROOM_NM"].ToString().Trim());
                        //TotalSales += decimal.Parse(row["BillCount"].ToString().Trim() == "" ? "0" : row["BillCount"].ToString().Trim());
                    }
                }
                SetGridBackColor(2);
                ClearGridRepeatData(2);

                #endregion
            }
            else if(searchType ==3)
            {
                #region 盘库信息

                strDateFrom = dtpDateFrom3.Text.Trim() == "" ? dtpDateFrom3.Value.ToString("yyyyMMdd") : dtpDateFrom3.Text.Trim().Replace("-", "").Replace("/", "");
                strDateTo = dtpDateTo3.Text.Trim() == "" ? dtpDateTo3.Value.ToString("yyyyMMdd") : dtpDateTo3.Text.Trim().Replace("-", "").Replace("/", "");
                if (ckbDetail3.Checked)//
                {
                    //显示详细
                    rvGoods = bll_M012_Member.GetStocktakingDetail(strDateFrom, strDateTo);
                }
                else
                {
                    //不显示详细
                    rvGoods = bll_M012_Member.GetStocktakingTotal(strDateFrom, strDateTo);
                }
                if (rvGoods.IsSuccess == false)
                {
                    Method.MessageShow(rvGoods.ErrorID,dataName);
                    this.Cursor = Cursors.Default;
                    return;
                }
                grdDetailInfo3.Rows.Clear();

                //显示详细
                if (ckbDetail3.Checked)
                {
                    foreach (DataRow row in rvGoods.ResultDataSet.Tables[0].Rows)
                    {
                        grdDetailInfo3.Rows.Add(
                            (grdDetailInfo3.Rows.Count + 1).ToString(),
                            DateFormat(row["BUSINESS_TIME"].ToString().Trim()),
                            row["BILL_ID"].ToString().Trim(),
                            row["GOODS_NM1"].ToString().Trim(),
                            row["UNITS"].ToString().Trim(),
                            row["NowUNITS"].ToString().Trim(),
                            row["STOREROOM_NM"].ToString().Trim());
                        //TotalSales += decimal.Parse(row["AllPrice"].ToString().Trim());
                    }
                }
                //不显示详细
                else
                {
                    foreach (DataRow row in rvGoods.ResultDataSet.Tables[0].Rows)
                    {
                        grdDetailInfo3.Rows.Add(
                            (grdDetailInfo3.Rows.Count + 1).ToString(),
                            DateFormat(row["BUSINESS_TIME"].ToString().Trim()),
                            row["BILL_ID"].ToString().Trim(),
                            row["GOODS_NM1"].ToString().Trim(),
                            row["UNITS"].ToString().Trim(),
                            row["NowUNITS"].ToString().Trim(),
                            row["STOREROOM_NM"].ToString().Trim());
                        //TotalSales += decimal.Parse(row["BillCount"].ToString().Trim() == "" ? "0" : row["BillCount"].ToString().Trim());
                    }
                }
                SetGridBackColor(3);
                ClearGridRepeatData(3);

                #endregion
            }

            
            this.Cursor = Cursors.Default;
        }

        /// <summary>	
        /// <p><b>方法名称</b>DateFormat</p>	
        /// <p><b>概要説明  :</b>date data format</p>	
        /// <p><b>作成者	:</b>万岗</p>	
        /// <p><b>作成日	:</b>2008/09/10</p>	
        /// <p><b>修改历史  :</b></p>	
        /// </summary>
        /// <param name="strValue">没有格式化的字符串</param> 
        /// <returns type="string">格式化后的字符串</returns>
        protected string DateFormat(string strValue)
        {
            if (strValue.Length < 8)
            {
                return strValue;
            }
            return strValue.Substring(0, 4) + "/" +
                strValue.Substring(4, 2) + "/" +
                strValue.Substring(6, 2);

        }

        /// <summary>	
        /// <p><b>方法名称</b>NumPriceFormat</p>	
        /// <p><b>概要説明  :</b>num and price data format</p>	
        /// <p><b>作成者	:</b>万岗</p>	
        /// <p><b>作成日	:</b>2008/09/10</p>	
        /// <p><b>修改历史:</b></p>	
        /// </summary>
        /// <param name="strValue">没有格式化的字符串</param> 
        /// <returns type="string">格式化后的字符串</returns>
        protected string NumPriceFormat(string strValue)
        {
            string strTemp = strValue;
            if (strValue.Length > 6)
            {
                strTemp = strValue.Substring(0, strValue.Length - 6) + ","
                    + strValue.Substring((strValue.Substring(0, strValue.Length - 6)).Length, 3)
                    + "," + strValue.Substring(strValue.Length - 3, 3);

            }
            else if (strValue.Length > 3)
            {
                strTemp = strValue.Substring(0, strValue.Length - 3) + ","
                + strValue.Substring((strValue.Substring(0, strValue.Length - 3)).Length, 3);
            }
            return strTemp;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="myExcel"></param>
        /// <param name="dsData"></param>
        private void WriteExlWithDataTable(Excel.Application myExcel, DataSet dsData)
        {
            Excel.Workbook myBook = myExcel.Workbooks[1];
            Excel.Worksheet mySheet = (Excel.Worksheet)myBook.Worksheets[1];
            Excel.Range r;
            Excel.Range r1;
            for (int i = 0; i < dsData.Tables[0].Rows.Count; i++)
            {
                r = (Excel.Range)mySheet.Rows.get_Item(i + 6, Missing.Value);
                r.Copy(Missing.Value);
                r1 = (Excel.Range)mySheet.Rows.get_Item(i + 7, Missing.Value);
                r1.PasteSpecial(XlPasteType.xlPasteFormats, XlPasteSpecialOperation.xlPasteSpecialOperationNone, false, false);
                myExcel.Cells[i + 6, 1] = "'" + (i + 1).ToString();
                myExcel.Cells[i + 6, 2] = "'" + dsData.Tables[0].Rows[i]["GOODS_ID"].ToString();
                //myExcel.Cells[i + 6, 3] = "'" + dsData.Tables[0].Rows[i]["GOODS_NO"].ToString();
                myExcel.Cells[i + 6, 3] = "'" + dsData.Tables[0].Rows[i]["GOODS_NM1"].ToString();
                myExcel.Cells[i + 6, 4] = "'" + dsData.Tables[0].Rows[i]["GOODS_NM2"].ToString();
                myExcel.Cells[i + 6, 5] = "'" + dsData.Tables[0].Rows[i]["GOODS_GROUP"].ToString();
                myExcel.Cells[i + 6, 6] = "'" + dsData.Tables[0].Rows[i]["PROVIDER"].ToString();
                myExcel.Cells[i + 6, 7] = "'" + dsData.Tables[0].Rows[i]["PRODUCE_DATE"].ToString();
                myExcel.Cells[i + 6, 8] = "'" + dsData.Tables[0].Rows[i]["OVER_PRODUCE_DATE"].ToString();
                //myExcel.Cells[i + 6, 10] = "'" + dsData.Tables[0].Rows[i]["OVER_DATE"].ToString();
                //myExcel.Cells[i + 6, 11] = "'" + dsData.Tables[0].Rows[i]["MAX_WARN"].ToString();
                //myExcel.Cells[i + 6, 12] = "'" + dsData.Tables[0].Rows[i]["MIN_WARN"].ToString();
                myExcel.Cells[i + 6, 9] = "'" + dsData.Tables[0].Rows[i]["BUYING_PRICE"].ToString();
                myExcel.Cells[i + 6, 10] = "'" + dsData.Tables[0].Rows[i]["SELLING_PRICE"].ToString();
                //myExcel.Cells[i + 6, 15] = "'" + dsData.Tables[0].Rows[i]["MEMO"].ToString();
            }
        }

        /// <summary>
        /// SaveFile
        /// </summary>
        /// <param name="strMobanName"></param>
        /// <param name="filename"></param>
        private void SaveFile(string strMobanName, out string filename)
        {
            SaveFileDialog mySave = new SaveFileDialog();
            mySave.Filter = "Excelﾎﾄｼ(*.XLS)|*.xls|ﾋﾐﾎﾄｼ(*.*)|*.*";
            if (mySave.ShowDialog() != DialogResult.OK)
            {
                filename = null;
                return;
            }
            else
            {
                filename = mySave.FileName;
                string filenameold = mySave.FileName;
                FileInfo mode = new FileInfo(System.Windows.Forms.Application.StartupPath.Trim() + "\\" + strMobanName);
                try
                {
                    mode.CopyTo(filename, true);
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                    return;
                }
            }
        }

        /// <summary>
        /// 设置不同流水号的销售信息不同背景色
        /// </summary>
        /// <param name="GridType"></param>
        private void SetGridBackColor(int GridType)
        {
            string strBillID = string.Empty;
            Color bkColor2=Color.Snow;
            DataGridView grid = null;
            if (GridType == 1)
            {
                grid = grdDetailInfo1;
            }
            else if (GridType == 2)
            {
                grid = grdDetailInfo2;
            }
            else if (GridType == 3)
            {
                grid = grdDetailInfo3;
            }


            for (int i = 0; i < grid.Rows.Count; i++)
            {
                if (i != 0 && grid.Rows[i].Cells["BILL_ID"].Value.ToString().Trim() != strBillID)
                {
                    if (bkColor2 == Color.Snow)
                    {
                        bkColor2 = Color.PowderBlue;
                    }
                    else
                    {
                        bkColor2 = Color.Snow;
                    }
                }
                grid.Rows[i].DefaultCellStyle.BackColor = bkColor2;
                strBillID = grid.Rows[i].Cells["BILL_ID"].Value.ToString().Trim();
            }
        }

        /// <summary>
        /// 清除Grid中的重複數據
        /// </summary>
        /// <param name="GridType"></param>
        private void ClearGridRepeatData(int GridType)
        {
            string strBillID = string.Empty;
            int intNO = 1;

            DataGridView grid = null;
            if (GridType == 1)
            {
                grid = grdDetailInfo1;
            }
            else if (GridType == 2)
            {
                grid = grdDetailInfo2;
            }
            else if (GridType == 3)
            {
                grid = grdDetailInfo3;
            }

            for (int i = 0; i < grid.Rows.Count; i++)
            {
                if (i == 0)
                {
                    strBillID = grid.Rows[i].Cells["BILL_ID"].Value.ToString().Trim();
                }
                if (i != 0 && grid.Rows[i].Cells["BILL_ID"].Value.ToString().Trim() == strBillID)
                {
                    grid.Rows[i].Cells["BUSINESS_TIME"].Value = "";
                    grid.Rows[i].Cells["BILL_ID"].Value = "";
                    //grdmentBillDetailInfo.Rows[i].Cells["BillCount"].Value = "";
                    //grdmentBillDetailInfo.Rows[i].Cells["Preferential"].Value = "";
                    //grdmentBillDetailInfo.Rows[i].Cells["USER_NAME"].Value = "";
                    //grdmentBillDetailInfo.Rows[i].Cells["USER_NO"].Value = "";
                    grid.Rows[i].Cells["NO."].Value = "";
                }
                else
                {
                    grid.Rows[i].Cells["NO."].Value = intNO;
                    strBillID = grid.Rows[i].Cells["BILL_ID"].Value.ToString().Trim();
                    intNO++;
                }

                if (i + 1 < grid.Rows.Count)
                {
                    if (grid.Rows[i + 1].Cells["BILL_ID"].Value.ToString().Trim() == strBillID)
                    {
                        if (grid.Columns.Contains("Preferential"))
                        {
                            grid.Rows[i].Cells["Preferential"].Value = "";
                        }
                        if (grid.Columns.Contains("BillCount"))
                        {
                            grid.Rows[i].Cells["BillCount"].Value = "";
                        }
                        //if (grid.Columns.Contains("USER_NAME"))
                        //{
                        //    grid.Rows[i].Cells["USER_NAME"].Value = "";
                        //}
                        //if (grid.Columns.Contains("USER_NO"))
                        //{
                        //    grid.Rows[i].Cells["USER_NO"].Value = "";
                        //}
                        //if (grid.Columns.Contains("STOREROOM"))
                        //{
                        //    grid.Rows[i].Cells["STOREROOM"].Value = "";
                        //}
                    }
                }
            }
            //统计销售总额及记录条数
            decimal TotalSales = 0m;
            if (GridType == 1 || GridType == 2)
            {
                for (int j = 0; j < grid.Rows.Count; j++)
                {
                    TotalSales += decimal.Parse(grid.Rows[j].Cells["BillCount"].Value.ToString().Trim() == "" ? "0" : grid.Rows[j].Cells["BillCount"].Value.ToString().Trim());
                }
            }

            if (GridType == 1)
            {
                grpBillDetailInfo.Text = "销售总额:" + string.Format("{0:f2}", TotalSales) + "  共有" + grid.Rows.Count + "条销售记录";
            }
            else if (GridType == 2)
            {
                grpBuyDetailInfo.Text = "进货总额:" + string.Format("{0:f2}", TotalSales) + "  共有" + grid.Rows.Count + "条进货记录";
            }
            else if (GridType == 3)
            {
                grpStocktakingInfo.Text = "共有" + grid.Rows.Count + "条盘库售记录";
            }
            
        }

        #endregion

        #region 事件

        private void M014_BILLSCAN_Detail_Load(object sender, EventArgs e)
        {
            this.StartPosition = FormStartPosition.CenterScreen;
            InitProcess();
        }

        /// <summary>
        /// btnClose_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnClose_Click(object sender, EventArgs e)
        {
            if (this.Cursor == Cursors.WaitCursor)
            {
                return;
            }
            this.Close();
        }

        /// <summary>
        /// btnPrint_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (grdDetailInfo1.Rows.Count < 1)
            {
                Method.MessageShow("W11049", dataName);//没有数据！
                return;
            }
            Print();
        }

        /// <summary>
        /// 打印销售记录
        /// </summary>
        private void Print()
        {
            //每次生成Excel前强制进行垃圾回收
            GC.Collect();
            if (Cursor.Current == Cursors.WaitCursor)
            {
                return;
            }
            if (Method.MessageShow("Q12014", dataName) == DialogResult.Yes)//确定要进行打印吗？
            {                
                //创建一个Excel文件  
                object missing = Missing.Value;
                Excel.Application appExcel = new Excel.Application();
                Excel.Workbooks myBooks = appExcel.Workbooks;
                //工作薄是否可见
                appExcel.Visible = false;
                //向Excel中添加一个工作薄
                Excel._Workbook workbook = myBooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
                //向工作薄中添加一个Sheet
                Excel.Worksheet mySheet = (Excel.Worksheet)workbook.Worksheets.Add(Missing.Value, Missing.Value, 1, Missing.Value);
                //使某个Sheet作为当前选择项
                ((Excel.Worksheet)appExcel.ActiveWorkbook.Sheets[1]).Select(Missing.Value);

                //myExcel.Application.Workbooks.Add(true); 
                //第一行为报表名称  
                mySheet.get_Range("A1", Missing.Value).Value2 = "销售记录";
                //这是单元格居中对齐
                mySheet.get_Range("A1", Missing.Value).HorizontalAlignment = Excel.XlVAlign.xlVAlignCenter;
                //这是行高
                mySheet.get_Range("A1", Missing.Value).RowHeight = 30;
                //设置字体
                mySheet.get_Range("A1", Missing.Value).Font.Bold = true;
                mySheet.get_Range("A1", Missing.Value).Font.Size = 15;
                //设置整个报表的标题为跨列居中
                //mySheet.get_Range("A1", Missing.Value).HorizontalAlignment = xlHAlignCenterAcrossSelection;
                //合并单元格
                mySheet.get_Range(appExcel.Cells[1, 1], appExcel.Cells[1, 9]).Merge(false);

                //NO.、日期、流水号、商品名称、价格、数量、合计、本单合计、优惠、会员姓名、会员卡号
                //NO.、BUSINESS_TIME、BILL_ID、GOODS_NM1、SELLING_PRICE、UNITS、AllPrice、BillCount、Preferential、USER_NAME、USER_NO
                appExcel.Cells[2, 1] = "日期";
                mySheet.get_Range("A2", Missing.Value).ColumnWidth = 8;
                mySheet.get_Range("A2", Missing.Value).Font.Bold = true;
                appExcel.Cells[2, 2] = "流水号";
                mySheet.get_Range("B2", Missing.Value).ColumnWidth = 11;
                mySheet.get_Range("B2", Missing.Value).Font.Bold = true;
                appExcel.Cells[2, 3] = "'商品名称";
                mySheet.get_Range("C2", Missing.Value).ColumnWidth = 26;
                mySheet.get_Range("C2", Missing.Value).Font.Bold = true;
                appExcel.Cells[2, 4] = "'单价";
                mySheet.get_Range("D2", Missing.Value).ColumnWidth = 5;
                mySheet.get_Range("D2", Missing.Value).Font.Bold = true;
                appExcel.Cells[2, 5] = "'数量";
                mySheet.get_Range("E2", Missing.Value).ColumnWidth = 4;
                mySheet.get_Range("E2", Missing.Value).Font.Bold = true;
                appExcel.Cells[2, 6] = "'合计";
                mySheet.get_Range("F2", Missing.Value).ColumnWidth =6;
                mySheet.get_Range("F2", Missing.Value).Font.Bold = true;

                appExcel.Cells[2, 7] = "'总计";
                mySheet.get_Range("G2", Missing.Value).ColumnWidth = 6;
                mySheet.get_Range("G2", Missing.Value).Font.Bold = true;

                appExcel.Cells[2, 8] = "'优惠";
                mySheet.get_Range("H2", Missing.Value).ColumnWidth = 4;
                mySheet.get_Range("H2", Missing.Value).Font.Bold = true;

                appExcel.Cells[2, 9] = "'会员";
                mySheet.get_Range("I2", Missing.Value).ColumnWidth = 5;
                mySheet.get_Range("I2", Missing.Value).Font.Bold = true;


                //逐行写入数据，  
                int intRow = 3;
                for (int i = 0; i < grdDetailInfo1.Rows.Count; i++)
                {
                    //以单引号开头，表示该单元格为纯文本  
                    appExcel.Cells[intRow + i, 1] = grdDetailInfo1.Rows[i].Cells["BUSINESS_TIME"].Value.ToString().Trim();//日期
                    appExcel.Cells[intRow + i, 2] = "'"+grdDetailInfo1.Rows[i].Cells["BILL_ID"].Value.ToString().Trim();//流水号
                    appExcel.Cells[intRow + i, 3] = grdDetailInfo1.Rows[i].Cells["GOODS_NM1"].Value.ToString().Trim();//商品名称
                    appExcel.Cells[intRow + i, 4] = grdDetailInfo1.Rows[i].Cells["SELLING_PRICE"].Value.ToString().Trim();//价格
                    appExcel.Cells[intRow + i, 5] = grdDetailInfo1.Rows[i].Cells["UNITS"].Value.ToString().Trim();//数量
                    appExcel.Cells[intRow + i, 6] = grdDetailInfo1.Rows[i].Cells["AllPrice"].Value.ToString().Trim();//合计
                    appExcel.Cells[intRow + i, 7] = grdDetailInfo1.Rows[i].Cells["BillCount"].Value.ToString().Trim();//本单合计
                    appExcel.Cells[intRow + i, 8] = grdDetailInfo1.Rows[i].Cells["Preferential"].Value.ToString().Trim();//优惠
                    appExcel.Cells[intRow + i, 9] = grdDetailInfo1.Rows[i].Cells["USER_NAME"].Value.ToString().Trim();//会员
                }
                mySheet.get_Range("A3", "I" + (grdDetailInfo1.Rows.Count + 2).ToString()).Font.Size = 10;
                //让Excel文件可见
                //工作薄是否可见
                appExcel.Visible = true;
            }
        }

        /// <summary>
        /// M014_BILLSCAN_Detail_KeyUp
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void M014_BILLSCAN_Detail_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.F5:
                    btnPrint_Click(sender, e);
                    break;
                case Keys.Escape:
                    btnClose_Click(sender, e);
                    break;
            }
        }

        /// <summary>
        /// 显示销售详细信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ckbDetail1_CheckedChanged(object sender, EventArgs e)
        {
            if (!blInit)
            {
                ShowGrid(1);
            }
        }

        /// <summary>
        /// 显示进货详细信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ckbDetail2_CheckedChanged(object sender, EventArgs e)
        {
            if (!blInit)
            {
                ShowGrid(2);
            }
        }

        /// <summary>
        /// 显示盘库详细信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ckbDetail3_CheckedChanged(object sender, EventArgs e)
        {
            if (!blInit)
            {
                ShowGrid(3);
            }
        }

        /// <summary>
        /// 查询销售信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            ShowGrid(1);
        }

        /// <summary>
        /// 查询进货信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch2_Click(object sender, EventArgs e)
        {
            ShowGrid(2);
        }

        /// <summary>
        /// 查询盘库信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch3_Click(object sender, EventArgs e)
        {
            ShowGrid(3);
        }

        #endregion
    }
}